<?php
	// Tạo search
	$ssFilter = $this->arrParam['ssFilter'];
	$action_link 	= $this->baseUrl($this->currentController . '/filter' . '/type/order');
	
	// Tạo tiêu đề dùng để sắp xếp
	$lblId 	= $this->cmsLinkSort('#ID', 'id', $ssFilter, $this->baseUrl(PUBLIC_PATH . '/img/icon'), $action_link);
	$lblDateCreated= $this->cmsLinkSort('Ngày giao dịch', 'ngay_thuc_hien', $ssFilter, $this->baseUrl(PUBLIC_PATH . '/img/icon'), $action_link);
	
	$tai_khoan = $this->tai_khoan;
?>

<div class="block">
	<div class="title">
		<span>Tài khoản scoins</span>
	</div>
	<div class="content">
		<div class="wrap-content">
			<div id="toolbar-box" class="toolbar">
				<div class="top-box">
					<div class="top-box">
						<div class="top-box"></div>
					</div>
				</div>
				<div class="m-box">
					<img class="float-left" src="<?php echo $this->baseUrl(PUBLIC_PATH . "/img/icon/coin_icon.png");?>" alt="scoins" />
					<table class="float-left">
						<tr>
							<td><label>Tài khoản chính</label></td>
							<td><span><?php echo number_format($tai_khoan->tai_khoan_chinh, 0, ",", ","); ?></span></td>
						</tr>
						<tr>
							<td><label>Tài khoản khuyến mãi</label></td>
							<td><span><?php echo number_format($tai_khoan->tai_khoan_khuyen_mai, 0, ",", ","); ?></span></td>
						</tr>
					</table>
					<div class="clear"></div>
				</div>
				<div class="bottom-box">
					<div class="bottom-box">
						<div class="bottom-box"></div>
					</div>
				</div>
			</div>
			<div class="box">
				<h3 class="header">
					<span>Lịch sử giao dịch</span>
				</h3>
				<div class="box-content">
					<?php if ($this->totalItems == 0) {?>
						<p class="red-text">Chưa có cuộc giao dịch nào</p>
					<?php } else { ?>
						<table class="gridview" id="tinraotb">
							<thead>
								<tr>
									<th width="42px"><?php echo $lblId; ?></th>
									<th>Đường dẫn tin</th>
									<th>Gói tin</th>
									<th>Giá</th>
									<th><?php echo $lblDateCreated; ?></th>
								</tr>
							</thead>
							<tbody>
								<?php
									foreach($this->Items as $key => $val) {
										$id    		 	= $val->getId();
										$url_tin	 	= $val->getUrl_tin();
										$goi_tin	 	= $val->getGoiTinObj();
										$ngay_giao_dich = $val->getNgay_thuc_hien('d-m-Y H:i:s');
										echo '<tr id=' . $id . '>';
										echo '<td style="padding: 9px 0;" align="center">' . $id . '</td>';
										echo '<td><a href="' . $this->baseUrl('/' . $url_tin) . '">' . $url_tin . '</a></td>';
										echo '<td align="center" title="' . $goi_tin->ten . '">' . $goi_tin->ten . '</td>';
										echo '<td align="center">' . number_format($goi_tin->getGia_tien(), 0, ",", ",") . '</td>';
										echo '<td class="cell-padding">' . $ngay_giao_dich . '</td>';
										echo '</tr>';
									}
								?>
							</tbody>
							<!-- BEGIN: PAGINATION (FOOT) -->
							<tfoot>
								<tr>
									<td colspan="5">
										<div class="pagination">
											<?php
												$currentUrl = $this->baseUrl($this->currentController . '/taikhoan');
												echo $this->paginationControl($this->panigator, 'Sliding', 'pagination.phtml', array('currentUrl' => $currentUrl));
											?>
										</div>
									</td>
								</tr>
							</tfoot>
							<!-- END: PAGINATION (FOOT) -->
						</table>
					<?php }?>
				</div>
			</div>
		</div>
		<br class="clear" />
	</div>
</div>